<template>
  <view class="page">
<!--		暂时注释掉，勿删-->
<!--    <view class="header">-->
<!--      <view></view>-->
<!--      <view-->
<!--        class="statistics"-->
<!--        @click="-->
<!--          $uni.navigateTo({-->
<!--            url: '/markingCampaign/pages/recommender/inviteStatistics',-->
<!--          })-->
<!--        "-->
<!--        >统计</view-->
<!--      >-->
<!--    </view>-->
    <view class="invite-list">
      <view
        class="invite-item"
        v-for="item in inviteList"
        :key="item.id"
        @click="
          $uni.navigateTo({
            url:
              '/markingCampaign/pages/recommender/inviteRecordDetail?newUserId=' +
              item.id,
          })
        ">
        <view class="row">
          <view class="username">{{ item.newNickName }}</view>
          <view class="date">{{ item.createTime }}</view>
        </view>
        <view class="row">
          <view class="project">{{ item.registerAppStr }}</view>
        </view>
      </view>
      <view v-if="!loading && (!inviteList || inviteList.length < 1)">
        <empty height="calc(100vh - 94rpx)"></empty>
      </view>
    </view>
  </view>
</template>
<script>
import request from "@/utils/request.js"
import empty from "@/components/empty.vue"
export default {
  data() {
    return {
      inviteList: [],
      loading: false,
    }
  },
  components: { empty },
  onShow() {
    this.getInviteList()
  },
  methods: {
    getInviteList() {
      this.loading = true
      uni.showLoading({
        title: "加载中",
      })
      request({
        url: "/userShare/getPageByClient",
        method: "post",
        data: {
          page: 1,
          size: -1,
        },
      })
        .then((res) => {
          this.inviteList = res.records
        })
        .catch((err) => {
          console.log(err, "err")
          uni.showToast({
            title: err,
            icon: "none",
          })
        })
        .finally((_) => {
          uni.hideLoading()
          this.loading = false
        })
    },
  },
  onPullDownRefresh(){
    this.getInviteList()
    uni.stopPullDownRefresh()
  },
}
</script>
<style lang="scss" scoped>
.page {
  min-height: 100vh;
  .header {
    padding: 16rpx 28rpx;
    background: #f7f7f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .statistics {
      padding: 10rpx 40rpx;
      background: #1b9b69;
      border-radius: 8rpx 8rpx 8rpx 8rpx;
      color: white;
    }
  }
  .invite-list {
    padding: 0 28rpx;
    .invite-item {
      border-bottom: 2rpx solid #eeeeee;
      padding: 28rpx 0;
      .row:not(:first-child) {
        margin-top: 16rpx;
      }
      .row {
        display: flex;
        justify-content: space-between;
        .username {
          color: #333333;
          font-size: 30rpx;
          font-weight: 500;
        }
        .date {
          color: #999999;
          font-size: 26rpx;
        }
        .project {
          color: #666666;
          font-size: 26rpx;
        }
      }
    }
  }
}
</style>
